import React from 'react';
import {NativeModules, Platform} from 'react-native';

var Manager = NativeModules.YuanXinCookieManager;
export default class CookieManager {
    static set(params,callback) {
         Manager.set(params,callback);
    }

    static setFromResponse(params,callback) {
        Manager.setFromResponse(params,callback);
    }

    static get(params,callback) {
        Manager.get(params,callback);
    }

    static getAll(callback) {
        Manager.getAll(callback);
    }

    static clearAll(callback) {
        Manager.clearAll(callback);
    }

    static clearByName(params,callback) {
        Manager.clearByName(params,callback);
    }

    static clearWebviewCache(callback) {
        Manager.clearWebviewCache && Manager.clearWebviewCache(callback);
    }

    static setArrays(params) {
        for(let i =0;i<params.length;i++){
            Manager.set(params[i],(err,res)=>{
                console.log("err"+err)
                console.log("res"+res)
            });
        }
    }
}
